package android.FiltrosJava;

import java.awt.AlphaComposite;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;

public class DrawPlayingCard extends AbstractImageBasic{
	public BufferedImage applyFilter(BufferedImage src) {
		//fazer tratamento de escala da imagem...
		int borda = 60;
		BufferedImage p = new BufferedImage( src.getWidth()+2*borda, src.getHeight()+borda, BufferedImage.TYPE_INT_ARGB);
		Graphics2D g = p.createGraphics();
		g.fillRect(0, 0, src.getWidth()+2*borda, src.getHeight()+borda);
		g.drawImage( src, borda, borda, null );		
    	g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));

    	BufferedImage pCard = new BufferedImage( src.getWidth()+2*borda, 2*(src.getHeight()+borda), BufferedImage.TYPE_INT_ARGB);
    	Graphics2D gCard = pCard.createGraphics();    	
    	gCard.drawImage( p, 0, 0, null );
    	
    	RotateTransform f = new RotateTransform(180);
    	p = f.applyFilter(p);    	    	 	    	
    	
    	gCard.drawImage( p, 0, src.getHeight()+borda, null );
    	
		return pCard;		
	}
}
